from exams.models import Exam
from exams.models import Question
from exams.models import Choice
from django.contrib import admin

class ChoiceInline(admin.TabularInline):
    model = Choice

class QuestionInline(admin.TabularInline):
    model = Question

class ExamAdmin(admin.ModelAdmin):
    fieldsets = [
        (None,               {'fields':['exam_id']}),
        (None,               {'fields':['name']}),
        ('Date information', {'fields': ['date_created']},),
        ('Exams date information', {'fields': ['date_valid'],}),
        ('Exams expired date', {'fields': ['date_expired']},),

    ]
    inlines = [QuestionInline]
    list_display = ('name', 'date_expired')
admin.site.register(Exam, ExamAdmin)

class QuestionAdmin(admin.ModelAdmin):
    fieldsets = [
        (None,               {'fields':['question_Number']}),
        (None,               {'fields':['exam_id']}),
        (None,               {'fields':['question_descriptions']}),
    ]
    list_display = ('question_Number','exam_id','question_descriptions')
    inlines = [ChoiceInline]
admin.site.register(Question, QuestionAdmin)

admin.site.register(Choice)





